package jsc.graph;

import java.io.File;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;

import jsc.acid.Dictionary;

/**
 * This class display a frame wich holds some dictionaries via an instance of the ComponentDictionary class 
 * 
 * @author Alec Ermis, Maxime Rihouey
 *
 */
public class FrameDictionary extends JFrame{

	private int numberOfDictionaries;
	private static int height = 600;
	private static int width = 200;
	private JTabbedPane tabbedPane;

	// constructors
	public FrameDictionary(){
		initialize();
	}

	// methods
	public void initialize(){
		this.setTitle("Dictionaries");
		this.setSize(width,height);
		tabbedPane = new JTabbedPane();
		this.getContentPane().add(tabbedPane);
		numberOfDictionaries = 0;
	}

	public void add(Dictionary dictionary){
		numberOfDictionaries++;
		tabbedPane.addTab(dictionary.getName(), new ComponentDictionary(dictionary));

	}

	/*
	 * Test
	 */
	public static void main(String[] args) {
		FrameDictionary dictionaries = new FrameDictionary();
		try {
			dictionaries.add(new Dictionary(new File("dicts/log.txt"),true));
			dictionaries.add(new Dictionary(new File("dicts/compsci.jsc"),true));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
